/**
 * 根据source更新target中的属性值
 * @param target
 * @param source
 */
export const updateVal = (target, source) => {
    for (const key in target) {
        if(source[key]){
            target[key] = source[key];
        }
    }
};
/**
 * 拷贝
 * @param arg
 */
export const copy = arg => {
    return JSON.parse(JSON.stringify(arg));
};

// region TODO 判断表单是否必填
export const judgmentRequired = (stair, secondLevel, Form, Required, Placeholder, isShow) => {
    const firstLevelArrayOfRequiredFields = ['17', '18', '19', '21', '2', '24', '25', '7', '1732711796952838145'];
    const level2RequiredField = ['20', '22', '11'];
    const level3RequiredFields = ['26', '27', '28', '29', '30', '31', '32', '33', '34','1770351691674185729'];
    const level4RequiredFields = ['35', '36', '37','1770353559842353153'];
    const level5RequiredFields = ['38', '39', '40'];
    Required.onetype = false; // 就业状况
    Required.type = false; // 就业类别 当前选中的每级value
    Required.dwmc = false; // 单位名称
    Required.tyshxycode = false; // 组织机构代码
    Required.dwxz = false; // 单位性质
    Required.dwhy = false; // 单位行业
    Required.dwszd = false; // 单位所在地
    Required.gzzwlb = false; // 工作职位类别
    Required.dwlxr = false; // 单位联系人
    Required.lxrdw = false; // 单位联系人电话
    Required.dwdh = false; // 联系人手机
    Required.lxrfax = false; // 联系人传真
    Required.dwdz = false; // 单位地址
    Required.dwyb = false; // 单位邮编
    Required.zzhxz = false; // 工资收入
    Required.lxremail = false; //联系人Email
    Required.extendWord1 = false; // 扩充字段1
    Required.extendWord2 = false; // 扩充字段2
    Required.extendWord3 = false; // 扩充字段3
    Required.extendWord4 = false; // 扩充字段4
    Required.extendWord5 = false; // 扩充字段5
    Required.zmcl = false; //证明材料
    Required.isBaseEmployment = false; // 是否基层就业
    Required.enterpriseSize = false; // 企业规模
    Required.enterpriseRevenue = false; // 企业营收
    Required.major = false; // 升学专业
    Required.lxgjdq = false; // 留学国家/地区
    Required.jwxxzwmc = false; //  学校中文名称
    Required.jwxxwwmc = false; // 学校外文名称
    Required.lxzyzwmc = false; // 留学专业中文名称
    Required.lxzywwmc = false; // 留学专业外文名称
    Required.lxxl = false; // 留学学历

    isShow.dwmc = false; // 单位名称
    isShow.tyshxycode = false; // 组织机构代码
    isShow.dwxz = false; // 单位性质
    isShow.dwhy = false; // 单位行业
    isShow.dwszd = false; // 单位所在地
    isShow.gzzwlb = false; // 工作职位类别
    isShow.dwlxr = false; // 单位联系人
    isShow.lxrdw = false; // 单位联系人电话
    isShow.dwdh = false; // 联系人手机
    isShow.lxrfax = false; // 联系人传真
    isShow.dwdz = false; // 单位地址
    isShow.dwyb = false; // 单位邮编
    isShow.zzhxz = false; // 工资收入
    isShow.lxremail = false; //联系人Email
    isShow.extendWord1 = false; // 扩充字段1
    isShow.extendWord2 = false; // 扩充字段2
    isShow.extendWord3 = false; // 扩充字段3
    isShow.extendWord4 = false; // 扩充字段4
    isShow.extendWord5 = false; // 扩充字段5
    isShow.zmcl = false; //证明材料
    isShow.isBaseEmployment = false; // 是否基层就业
    isShow.enterpriseSize = false; // 企业规模
    isShow.enterpriseRevenue = false; // 企业营收
    isShow.major = false; // 升学专业
    isShow.lxgjdq = false; // 留学国家/地区
    isShow.jwxxzwmc = false; //  学校中文名称
    isShow.jwxxwwmc = false; // 学校外文名称
    isShow.lxzyzwmc = false; // 留学专业中文名称
    isShow.lxzywwmc = false; // 留学专业外文名称
    isShow.lxxl = false; // 留学学历
    //判断必填
    if (stair == 0) {
        Required.isBaseEmployment = true;
        if (firstLevelArrayOfRequiredFields.includes(secondLevel)) {
            Required.dwmc = true;
            Required.tyshxycode = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.zmcl = true;
            Required.lxremail = true;
        } else if (level2RequiredField.includes(secondLevel)) {
            Required.dwmc = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.zmcl = true;
            Required.lxremail = true;
        } else if (level3RequiredFields.includes(secondLevel)) {
            Required.dwmc = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.zmcl = true;
            Required.lxremail = true;
        } else if (secondLevel == 4) {
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.zmcl = true;
        } else if (secondLevel == 8) {
            Required.dwmc = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.zmcl = true;
        } else if (secondLevel == 48) {
            Required.dwmc = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.lxremail = true;
            Required.zmcl = true;
        }
    } else if (stair == 1) {
        Required.isBaseEmployment = true;
        if (level4RequiredFields.includes(secondLevel)) {
            Required.dwmc = true;
            Required.tyshxycode = '1770353559842353153' !== secondLevel;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.lxremail = true;
            Required.zmcl = true;
            Required.enterpriseSize = true;
            Required.enterpriseRevenue = true;
        }
    } else if (stair == 2) {
        if (level5RequiredFields.includes(secondLevel)) {
            Required.dwmc = true;
            Required.dwszd = true;
            Required.major = true;
            Required.zmcl = true;
        }
        if (secondLevel == 11) {
            Required.lxgjdq = true;
            Required.jwxxzwmc = true;
            Required.jwxxwwmc = true;
            Required.lxzyzwmc = true;
            Required.lxzywwmc = true;
            Required.lxxl = true;
            Required.zmcl = true;
        }
    } else if (stair == 3) {
        if (firstLevelArrayOfRequiredFields.includes(secondLevel)) {
            Required.dwmc = true;
            Required.tyshxycode = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.lxremail = true;
            Required.zmcl = true;
            Required.isBaseEmployment = true;
        }
    } else if (stair == 4) {
        if (secondLevel == 15) {
            Required.dwmc = true;
        }else if (secondLevel == 8) {
            Required.isBaseEmployment = true;

            Required.dwmc = true;
            Required.dwxz = true;
            Required.dwhy = true;
            Required.dwszd = true;
            Required.gzzwlb = true;
            Required.dwlxr = true;
            Required.lxrdw = true;
            Required.zmcl = true;
        }
    }
    console.log("stair",stair)
    console.log("secondLevel",secondLevel)
    // 默认值&提示
    if (stair == 0) {
        if (secondLevel == 20) {
            Form.dwxz = '40';
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 22) {
            Form.dwxz = '99';
            Form.dwhy = '46';
            Form.dwszd = '国外';
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 24 || secondLevel == 25) {
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '填写毕业生服务地区';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 4) {
            Form.dwxz = '40';
            Form.dwhy = '80';
            Form.gzzwlb = '80';
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 26 || secondLevel == 27 || secondLevel == 28) {
            Placeholder.dwmc = '填写项目所在单位';
            Placeholder.dwszd = '填写项目所在地区';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 29 || secondLevel == 30 || secondLevel == 31 || secondLevel == 32 || secondLevel == 33 || secondLevel == 34) {
            Placeholder.dwmc = '填写项目所在单位';
            Placeholder.dwszd = '填写项目所在地区';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 8) {
            Form.dwxz = '';
            Form.dwhy = '';
            Form.gzzwlb = '';
            Placeholder.dwmc = '填写所从事自由职业内容';
            Placeholder.dwszd = '填写项目所在地区';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 48) {
            Form.dwxz = '';
            Form.dwhy = '';
            Form.dwszd = [];
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }else{
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }
    } else if (stair == 1) {
        if (secondLevel == 35 || secondLevel == 36 || secondLevel == 37) {
            Placeholder.dwmc = '填写具体创业项目';
            Placeholder.dwszd = '填写创业所在地区';
            Placeholder.dwhy = '选择创业从事行业';
        } else if (secondLevel == 8) {
            Form.dwxz = '';
            Form.dwhy = '';
            Form.gzzwlb = '';
            Placeholder.dwmc = '填写所从事自由职业内容';
            Placeholder.dwszd = '填写项目所在地区';
            Placeholder.dwhy = '请选择或输入';
        }else{
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }
    } else if (stair == 2) {
        if (secondLevel == 11 || secondLevel == 38 || secondLevel == 39 || secondLevel == 40) {
            Placeholder.dwmc = '填写升学的学校';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }else{
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }
    } else if (stair == 3) {
        if (secondLevel == 41 || secondLevel == 42 || secondLevel == 43 || secondLevel == 44 || secondLevel == 45) {
            Placeholder.dwmc = '填写求职中/签约中/拟参加公招考试/拟创业/拟应征入伍';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 13) {
            Form.dwmc = '拟升学';
            Placeholder.dwmc = '请填写';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        } else if (secondLevel == 46 || secondLevel == 47) {
            Form.dwmc = '';
            Placeholder.dwmc = '填写暂不就业/拟出国出境';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }else{
            Placeholder.dwmc = '请输入单位名称';
            Placeholder.dwszd = '请选择或输入';
            Placeholder.dwhy = '请选择或输入';
        }
    }else if (stair == 4) {
        // 留学
        if (secondLevel == 8) {
            Form.dwxz = '';
            Form.dwhy = '';
            Form.gzzwlb = '';
            Placeholder.dwmc = '填写所从事自由职业内容';
            Placeholder.dwszd = '填写项目所在地区';
            Placeholder.dwhy = '请选择或输入';
        }
    } else {
        Placeholder.dwmc = '请填写';
        Form.dwmc = '';
        Placeholder.dwhy = '请填写';
        Form.dwxz = '';
        Form.dwhy = '';
        Form.dwszd = [];
        Placeholder.dwszd = '请填写';
    }

    //是否显示
    if (stair == 0) {
        isShow.dwmc = true; // 单位名称
        isShow.tyshxycode = true; // 组织机构代码
        isShow.dwxz = true; // 单位性质
        isShow.dwhy = true; // 单位行业
        isShow.dwszd = true; // 单位所在地
        isShow.gzzwlb = true; // 工作职位类别
        isShow.dwlxr = true; // 单位联系人
        isShow.lxrdw = true; // 单位联系人电话
        isShow.dwdh = true; // 联系人手机
        isShow.lxrfax = true; // 联系人传真
        isShow.dwdz = true; // 单位地址
        isShow.dwyb = true; // 单位邮编
        isShow.zzhxz = true; // 工资收入
        isShow.lxremail = true; //联系人Email
        isShow.zmcl = true; //证明材料
        isShow.isBaseEmployment = true; // 是否基层就业
    } else if (stair == 1) {
        isShow.dwmc = true; // 单位名称
        isShow.tyshxycode = true; // 组织机构代码
        isShow.dwxz = true; // 单位性质
        isShow.dwhy = true; // 单位行业
        isShow.dwszd = true; // 单位所在地
        isShow.gzzwlb = true; // 工作职位类别
        isShow.dwlxr = true; // 单位联系人
        isShow.lxrdw = true; // 单位联系人电话
        isShow.dwdh = true; // 联系人手机
        isShow.lxrfax = true; // 联系人传真
        isShow.dwdz = true; // 单位地址
        isShow.dwyb = true; // 单位邮编
        isShow.zzhxz = true; // 工资收入
        isShow.lxremail = true; //联系人Email
        isShow.zmcl = true; //证明材料
        isShow.isBaseEmployment = true; // 是否基层就业
        isShow.enterpriseSize = true; // 企业规模
        isShow.enterpriseRevenue = true; // 企业营收
    } else if (stair == 2) {
        if (level5RequiredFields.includes(secondLevel)) {
            isShow.dwmc = true; // 单位名称
            isShow.dwszd = true; // 单位所在地1
            isShow.zmcl = true; //证明材料
            isShow.major = true; // 升学专业
        } else if (secondLevel == 11) {
            isShow.lxgjdq = true; // 留学国家/地区
            isShow.jwxxzwmc = true; //  学校中文名称
            isShow.jwxxwwmc = true; // 学校外文名称
            isShow.lxzyzwmc = true; // 留学专业中文名称
            isShow.lxzywwmc = true; // 留学专业外文名称
            isShow.lxxl = true; // 留学学历
            isShow.zmcl = true; //证明材料
        }
    } else if (stair == 3) {
        if (secondLevel == 1732711796952838145) {
            isShow.dwmc = true; // 单位名称
            isShow.tyshxycode = true; // 组织机构代码
            isShow.dwxz = true; // 单位性质
            isShow.dwhy = true; // 单位行业
            isShow.dwszd = true; // 单位所在地
            isShow.gzzwlb = true; // 工作职位类别
            isShow.dwlxr = true; // 单位联系人
            isShow.lxrdw = true; // 单位联系人电话
            isShow.dwdh = true; // 联系人手机
            isShow.lxrfax = true; // 联系人传真
            isShow.dwdz = true; // 单位地址
            isShow.dwyb = true; // 单位邮编
            isShow.zzhxz = true; // 工资收入
            isShow.lxremail = true; //联系人Email
            isShow.zmcl = true; //证明材料
            isShow.isBaseEmployment = true; // 是否基层就业
        } else {

        }
    }else if (stair == 4) {
        isShow.dwmc = true; // 单位名称
        isShow.tyshxycode = true; // 组织机构代码
        isShow.dwxz = true; // 单位性质
        isShow.dwhy = true; // 单位行业
        isShow.dwszd = true; // 单位所在地
        isShow.gzzwlb = true; // 工作职位类别
        isShow.dwlxr = true; // 单位联系人
        isShow.lxrdw = true; // 单位联系人电话
        isShow.dwdh = true; // 联系人手机
        isShow.lxrfax = true; // 联系人传真
        isShow.dwdz = true; // 单位地址
        isShow.dwyb = true; // 单位邮编
        isShow.zzhxz = true; // 工资收入
        isShow.lxremail = true; //联系人Email
        isShow.zmcl = true; //证明材料
        isShow.isBaseEmployment = true; // 是否基层就业
    }
};
// endregion
